<template>
  <Header :check="4"
          @getUserInfo="getUserInfo" />
  <div class="clear_nav"></div>
  <div id="ecology">
    <div class="list">
      <template v-if="imgList.length">
        <div class="cell"
             v-for="(item, index) in imgList"
             :key="index"
             @click="goOut(index)">
          <img :src="item.images_url"
               alt="" />
          <div>
            <p>{{ item.name }}</p>
            <h5 v-if="item.is_enable == 1">{{ $t("hl_seeMore") }}</h5>
            <h6 v-if="item.is_enable == 0">{{ $t("hl_noMore") }}</h6>
          </div>
        </div>
      </template>
      <template v-else>
        <div class="no_data">
          <img src="../assets/img/mine/nodata.png" />
          <div>{{ $t("hl_noData") }}</div>
        </div>
      </template>
    </div>
  </div>
</template>

<script setup>
import { ref, reactive, watch } from "vue";
import {
  showFailToast,
  showSuccessToast,
  showLoadingToast,
  closeToast,
} from "vant";
import { getFloat } from "../utils/common";
import { useRouter } from "vue-router";
import i18n from "@/lang";

const router = useRouter();

let address = ref("");

let imgList = ref([
  {
    images_url: require("../assets/img/ecology/e1.png"),
    is_enable: 0,
    name: '',
    url: ''
  },
  {
    images_url: require("../assets/img/ecology/e2.png"),
    is_enable: 0,
    name: '',
    url: ''
  },
  {
    images_url: require("../assets/img/ecology/e3.png"),
    is_enable: 0,
    name: '',
    url: ''
  },
]);

// 那得的数据
function getUserInfo (obj) {
  address.value = obj.address;
}


function goOut (index) {
  let url = imgList.value[index].url;
  if (url)
  {
    window.location.href = url;
  }
}
</script>

<style scoped lang="less">
#ecology {
  padding: 10px 3% 0;

  .list {
    .cell {
      width: 100%;
      padding: 5%;
      border-bottom: 3px solid #d9d9d9;
      img {
        width: 100%;
        margin-bottom: 24px;
      }

      div {
        display: flex;
        align-items: center;
        justify-content: space-between;

        p {
          font-size: 17px;
          font-weight: bolder;
        }

        h5 {
          background: #1296db;
          color: white;
          padding: 0 12px;
          border-radius: 4px;
          line-height: 36px;
          height: 36px;
        }
        h6 {
          color: #1296db;
          border: 1px solid #1296db;
          padding: 0 12px;
          border-radius: 4px;
          line-height: 36px;
          height: 36px;
        }
      }
    }
  }
}
</style>
